-
Notifications
You must be signed in to change notification settings - Fork 513
Fix tests by using API Key for CI #2255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix tests by using API Key for CI #2255
Conversation
src/features/UpdatePowerShell.ts
Outdated
// Fetch the latest PowerShell releases from GitHub. | ||
let releaseJson: any; | ||
if (preview) { | ||
// This gets all releases and the first one is the latest prerelease if | ||
// there is a prerelease version. | ||
releaseJson = (await fetch(PowerShellGitHubPrereleasesUrl) | ||
releaseJson = (await fetch(PowerShellGitHubPrereleasesUrl, requestConfig) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the point of await
to obviate the need for then()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's either this or double awaiting which I felt was a tad less clear with the extra parens and more verbose than an intermediate variable. I can change it if you'd like.
await (await fetch(PowerShellGitHubReleasesUrl, requestConfig)).json();
// or
const res = await fetch(PowerShellGitHubReleasesUrl, requestConfig);
releaseJson = await res.json();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No no, no need to derail the PR
@rjmholt refactored for better error handling. I ran CI like 5-8 times and green every time. |
PR Summary
Fixes the tests by using an API Key for CI so that we aren't rate limited by GitHub's APIs.
PR Checklist
Note: Tick the boxes below that apply to this pull request by putting an
x
between the square brackets.Please mark anything not applicable to this PR
NA
.WIP:
to the beginning of the title and remove the prefix when the PR is ready